package ui.administrator;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JCheckBoxMenuItem;
import java.awt.Font;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JInternalFrame;
import javax.swing.JDesktopPane;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.Insets;
import javax.swing.JSeparator;

import controller.AdministratorController;

public class Administrator extends JFrame {
	//private AdministratorController adminController; 
	
	private JPanel contentPane;
	public AdaugaAsistent addAsistent=new AdaugaAsistent();
	public VizualizareAsistenti vizAsistenti=new VizualizareAsistenti();
	public VizualizareActivitati vizActivitate=new VizualizareActivitati();
	public VizualizareSponsori vizSponsori=new VizualizareSponsori();
	public VizualizareVoluntari vizVoluntari=new VizualizareVoluntari();
	public AdaugaSponsor addSponsor=new AdaugaSponsor();
	public AdaugaVoluntar addVoluntar=new AdaugaVoluntar();
	public Venit venit=new Venit();
	
	
	
	/**
	 * Launch the application.
	 */
	public class UI{
		public void showPanel(JPanel panel){
			contentPane.removeAll();
			
	        panel.setBounds(0, 0,contentPane.getWidth(),contentPane.getHeight());
		     panel.setVisible(true);	 
		     contentPane.add(panel,BorderLayout.NORTH);
		     contentPane.updateUI();
		}
		public void showAsistenti(){
			showPanel(vizAsistenti);
		}
		public void addAsistenti(){
			
			showPanel(addAsistent);
		}
		public void showSponsor(){
			showPanel(vizSponsori);
		}
		public void addSponsor(){
			
			showPanel(addSponsor);
		}
		public void showVoluntari(){
			showPanel(vizVoluntari);
		}
		public void addVoluntar(){
			
			showPanel(addVoluntar);
		}
		public void showActivitate(){
			showPanel(vizActivitate);
		}
		public void showVenit(){
			
			showPanel(venit);
		}
		
	}
	
	
	
	
	UI ui = new UI(); 
	VizualizareSponsori vizSponsor= new VizualizareSponsori();
	public Administrator() {
		setResizable(false);
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 1035, 640);
		
		JMenuBar menuBar = new JMenuBar();
		menuBar.setFont(new Font("Segoe UI", Font.BOLD, 15));
		menuBar.setBackground(new Color(173, 216, 230));
		setJMenuBar(menuBar);
		
		JMenu mnAsistenti = new JMenu("Asistenti");
		mnAsistenti.setFont(new Font("Arial", Font.BOLD, 16));
		mnAsistenti.setBackground(new Color(169, 169, 169));
		menuBar.add(mnAsistenti);
		
		JMenuItem mntmVizualizare = new JMenuItem("Vizualizeaza");
		mntmVizualizare.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ui.showAsistenti();
		
			
		 
					}
	});
		mntmVizualizare.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/view.png")));
		mntmVizualizare.setBackground(new Color(173, 216, 230));
		mnAsistenti.add(mntmVizualizare);
		
		JMenuItem mntmAdauga = new JMenuItem("Adauga");
		mntmAdauga.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				
			}
		});
		mntmAdauga.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ui.addAsistenti();
				
			}
		});
		mntmAdauga.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/add1.png")));
		mntmAdauga.setBackground(new Color(173, 216, 230));
		mnAsistenti.add(mntmAdauga);
		
		JMenu mnSponsori = new JMenu("Sponsori");
		mnSponsori.setFont(new Font("Arial", Font.BOLD, 16));
		menuBar.add(mnSponsori);
		
		JMenuItem mntmVizualizare_1 = new JMenuItem("Vizualizeaza");
		mntmVizualizare_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ui.showSponsor();
			}
		});
		mntmVizualizare_1.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/view.png")));
		mntmVizualizare_1.setBackground(new Color(173, 216, 230));
		mnSponsori.add(mntmVizualizare_1);
		
		JMenuItem mntmAdauga_1 = new JMenuItem("Adauga");
		mntmAdauga_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ui.addSponsor();
				vizSponsor.getSponsori();
			}
		});
		mntmAdauga_1.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/add1.png")));
		mntmAdauga_1.setBackground(new Color(173, 216, 230));
		mnSponsori.add(mntmAdauga_1);
		
		JMenu mnVoluntari = new JMenu("Voluntari");
		mnVoluntari.setFont(new Font("Arial", Font.BOLD, 16));
		menuBar.add(mnVoluntari);
		
		JMenuItem mntmVizualizeaza = new JMenuItem("Vizualizeaza");
		mntmVizualizeaza.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ui.showVoluntari();
			}
		});
		mntmVizualizeaza.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/view.png")));
		mntmVizualizeaza.setBackground(new Color(173, 216, 230));
		mnVoluntari.add(mntmVizualizeaza);
		
		JMenuItem mntmAdauga_2 = new JMenuItem("Adauga");
		mntmAdauga_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ui.addVoluntar();
			}
		});
		mntmAdauga_2.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/add1.png")));
		mntmAdauga_2.setBackground(new Color(173, 216, 230));
		mnVoluntari.add(mntmAdauga_2);
		
		JMenu mnActivitati = new JMenu("Activitati");
		mnActivitati.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				ui.showActivitate();
			}
		});
		
		mnActivitati.setFont(new Font("Arial", Font.BOLD, 16));
		menuBar.add(mnActivitati);
		
		JMenu mnVenit = new JMenu("Venit");
		mnVenit.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				ui.showVenit();
			}
		});
		
		mnVenit.setFont(new Font("Arial", Font.BOLD, 16));
		menuBar.add(mnVenit);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(240, 255, 255));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnNewButton = new JButton("jmbbbbbbbbbbbbb");
		btnNewButton.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/view.png")));
		btnNewButton.setBounds(307, 148, 324, 48);
		contentPane.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("New button");
		btnNewButton_1.setBounds(307, 228, 324, 48);
		contentPane.add(btnNewButton_1);
		
		JButton btnNewButton_2 = new JButton("New button");
		btnNewButton_2.setBounds(307, 312, 324, 48);
		contentPane.add(btnNewButton_2);
		
		JButton btnNewButton_3 = new JButton("New button");
		btnNewButton_3.setBounds(307, 389, 324, 48);
		contentPane.add(btnNewButton_3);
		
		JLabel lblNewLabel = new JLabel("");
		lblNewLabel.setIcon(new ImageIcon(Administrator.class.getResource("/assets/images/user-add.png")));
		lblNewLabel.setBounds(33, 11, 196, 225);
		contentPane.add(lblNewLabel);
		
		JSeparator separator = new JSeparator();
		separator.setForeground(Color.GRAY);
		separator.setBackground(Color.BLUE);
		separator.setBounds(239, 92, 380, 26);
		contentPane.add(separator);
		
		//ppp= new a();		
		//desktopPane.add(ppp);
		//ppp.setVisible(true);
	}
	
	
}
